# Version 1.0 - Added createCluster
# Version 1.1 - Added virtualHost
# Version 1.2 - Added createFirstClusterMember
# Version 1.3 - Added createOWBJDBCDriver
# Version 1.4 - Added createDataSource                     
# Version 1.5 - Added modifyJvmServer
# Version 1.6 - Added modifyDS                             
# Version 1.7 - Added createSIB
# Version 1.8 - Added linkSIBToCluster 
# Version 1.9 - Added createSIBDestinations				   
# Version 1.10 - Added createActivationSpec
# Version 1.11 - Added createJmsQCF
# Version 1.12 - Added createJmsQueue
# Version 1.13 - Added createWebSphereVariable
# Version 1.14 - Added modifyJDK						   
# Version 1.15 - Added createSTGJDBCProvider
# Version 1.16 - Added createBOJDBCProvider
# Version 1.17 - Added modifyBOVirtualHostPort
# Version 1.18 - Added createTRADEJDBCProvider 
# Version 1.19 - Added modifyTradeVirtualHost				
# Version 1.20 - Added createDEDUPJdbcProvider 				 
# Version 1.21 - Added modifyPrimaryPorts
# Version 1.22 - Added modifyDS AGAIN                       ---> WORKING
# Version 1.23 - Added modifyDS2  
# Version 1.24 - Added createWebServer
# Version 1.25 - Added modifyVirtualHost
# Version 1.26 - Added splitLines							---> WORKING
# Version 1.27 - Added modifySecondaryPorts 
# Version 1.28 - Added Logging
# Version 1.29 - Added createWMQ
# Version 1.30 - Added createOWBJDBCDriver2  (To not break the old JDBC Driver)
# Version 1.31 - Added createDDSJDBCDriver2  (To not break the old JDBC Driver)
# Version 1.32 - Added createSTGJDBCDriver2  (To not break the old JDBC Driver)
# Version 1.33 - Added createBOJDBCDriver2  (To not break the old JDBC Driver)
# Version 1.34 - Added createTRADEJDBCDriver2  (To not break the old JDBC Driver)
# Version 1.35 - Added createDEDUPJDBCDriver2  (To not break the old JDBC Driver)


#######################################
# Create Cluster Without Members
#######################################
def createCluster(clusterName):
	return AdminTask.createCluster("[-clusterConfig [-clusterName "+clusterName+ " -preferLocal true ]]")
#endDef

#######################################
# Create Virtual Host Without Aliases
#######################################
def createVirtualHost(cellName,virtualHost):
    #1 virtualHost 
    return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:"+cellName+"/"), "[[name " +virtualHost+"]]")
#endDef

#########################
# Create Cluster Member
#########################
def createFirstClusterServer(clusterName,nodeName,serverName):
    #1  clusterName
    #1. serverName
    return AdminTask.createClusterMember("[-clusterName "+clusterName+ " -memberConfig [-memberNode " +nodeName+" -memberName "+serverName+" -memberWeight 2 -genUniquePorts false -replicatorEntry false] -firstMember [-templateName default -nodeGroup DefaultNodeGroup -coreGroup DefaultCoreGroup -resourcesScope cluster]]")
#endDef

############################
# Create OWB JDBC Provider
############################
def createOWBJDBCProvider(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'OWB SQL Driver' -description 'OWB SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")    
#endDef    

def createSTGDDSJDBCProviderWAS61(clusterName,jdbcProviderName):    
    #1. Change Cluster
	return AdminTas.createJDBCProvider("[-scope Cluster="+clusterName+"-databaseType 'SQL Server' -providerType 'WebSphere embedded ConnectJDBC driver for MS SQL Server' -implementationType 'Connection pool data source' -name 'STGDDS SQL Driver' -description 'STG DDS SQL Server JDBC Driver.' -classpath [${WAS_LIBS_DIR}/sqlserver.jar;${WAS_LIBS_DIR}/base.jar;${WAS_LIBS_DIR}/util.jar; ]  ]")    
#endDef    

###########################################################
# Create OWB JDBC Provider - NEW Implementation Class 1.30
###########################################################


def createOWBJDBCProvider2(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'OWB SQL Driver' -description 'OWB SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")    
#endDef    

#########################
# Create Datasource 
#########################
def createDataSource1(jdbcProviderName,cellName,clusterName,datasourceName,datasourceJNDI,database,server):
	#1. dataSourceName
	#2. dataSourceJNDI
	#3. database
	#4. server
	# Disable Logging : print " >> Beginning datasource creation "
	items = AdminConfig.list('JDBCProvider',AdminConfig.getid("/Cell:"+cellName+"/ServerCluster:"+clusterName))      
	lines = wsadminToList(items)
	print "Line 1 " +lines[0]
	print "Line 2 " +lines[1]
	xml = lines[1]
	#print "Object JDBC List Id"
	#newjdbc = AdminConfig.getid("/Cell:"+cellName+"/ServerCluster:"+clusterName+"/")
	#column=newjdbc.strip().split('#')
	#xml=column[1]
	#print "Xml id of SQL Driver" 
	#ServerCluster_1397373406452
	#print "new jdbc " + newjdbc
	#dsname = ['name',dataSourceName]
	#print " Set attributes " 
	#dsAttrs = [dsname]
	
	# Disable Logging : print "  >> Create DataSource"
	print " Datasource " + datasourceName
	print " Database is " + database
	print " Server is " +server
	AdminTask.createDatasource(xml, "[-name "+datasourceName+" -jndiName "+datasourceJNDI+" -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -containerManagedPersistence false -componentManagedAuthenticationAlias  -configureResourceProperties [[databaseName java.lang.String "+database+"] [portNumber java.lang.Integer 1433] [serverName java.lang.String "+server+" ]]]")
	print "  >> DataSource created "
    #jdbcList = items.split('\n')
    #print "Number of iterms ", len(jdbcList)
    #for objectName in jdbcList:
    #        object = AdminConfig.getid(objectName)
    #        print "Object is "+object
#endDef

def createDataSource2(jdbcProviderName,cellName,clusterName,datasourceName,datasourceJNDI,database,server):
	items = AdminConfig.list('JDBCProvider',AdminConfig.getid("/Cell:"+cellName+"/ServerCluster:"+clusterName))
	lines = wsadminToList(items)
	print "Line 1 " +lines[0]
	print "Line 2 " +lines[1]
	xml = lines[0]
	print " Datasource " + datasourceName
	print " Database is " +database
	print " Server is " +server
	AdminTask.createDatasource(xml, "[-name "+datasourceName+" -jndiName "+datasourceJNDI+" -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -containerManagedPersistence false -componentManagedAuthenticationAlias  -configureResourceProperties [[databaseName java.lang.String "+database+"] [portNumber java.lang.Integer 1433] [serverName java.lang.String "+server+" ]]]")
	print "  >> DataSource created "
#endDef

def createDataSource2(jdbcProviderName,cellName,clusterName,datasourceName,datasourceJNDI,database,server):
	#1. dataSourceName
	#2. dataSourceJNDI
	#3. database
	#4. server
	# Disable Logging : print  >> Beginning datasource creation 
	items = AdminConfig.list('JDBCProvider',AdminConfig.getid("/Cell:"+cellName+"/ServerCluster:"+clusterName))    
	lines = wsadminToList(items)
	print "Line 1 " +lines[0]
	print "Line 2 " +lines[1]
	xml = lines[0]
	# Disable Logging : print "  >> Create DataSource"
	print " jdbcProviderName " + jdbcProviderName
	print " Datasource JNDI " + datasourceName
	print " Datasource JNDI " + datasourceJNDI
	print " Database is " + database
	print " Server is " + server
	print " ===============> "
	AdminTask.createDatasource(xml, "[-name "+datasourceName+" -jndiName "+datasourceJNDI+" -dataStoreHelperClassName com.ibm.websphere.rsadapter.MicrosoftSQLServerDataStoreHelper -containerManagedPersistence false -componentManagedAuthenticationAlias  -configureResourceProperties [[databaseName java.lang.String "+database+"] [portNumber java.lang.Integer 1433] [serverName java.lang.String "+server+" ]]]")
	print "  >> DataSource created "
	#jdbcList = items.split('\n')
	#print "Number of iterms ", len(jdbcList)
	#for objectName in jdbcList:
	#object = AdminConfig.getid(objectName)
  #        print "Object is "+object
#endDef


##############################################################################    1.4 #################################################################################

#########################
# Modify JVM for Server 
#########################
def modifyJVMServer(nodeName,serverName,jvmMin,jvmMax, genericArgs):
    #1. NodeName
    #2. serverName
    #3. jvmMin  
    #4. jvmMax 
    #5. Generic Argument -- WORKING
    AdminTask.setJVMProperties("[-nodeName "+nodeName+" -serverName "+serverName+" -verboseModeClass false -verboseModeGarbageCollection false -verboseModeJNI false -initialHeapSize "+jvmMin+" -maximumHeapSize "+jvmMax+" -runHProf false -hprofArguments  -debugMode false -debugArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777' -executableJarFileName  -genericJvmArguments "+genericArgs+" -disableJIT false]")
#endDef


#######################################
# Modify OWB Virtual Host
#######################################

def modifyOWBVirtualHostPort(cellName,virtualHost,virtualHostPort):
    #return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:" +cellName+"/"), "[[name ," +virtualHost+ "]]")
    #1 cellName 
    #2 virtualHost -- WORKING   
    return AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9084"]]')    
#endDef


#######################################
# Modify DDS Virtual Host
#######################################

def modifyDDSVirtualHostPort(cellName,virtualHost,virtualHostPort):
    #return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:" +cellName+"/"), "[[name ," +virtualHost+ "]]")
    #1 cellName 
    #2 virtualHost -- WORKING   
    return AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9082"]]')    
#endDef



#######################################
# Modify DataSource
#######################################



##############################################################################    1.4 #################################################################################


###########################
# Create DDS JDBC Provider
###########################

def createDDSJDBCProvider(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'DDS SQL Driver' -description 'DDS SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ] -implementationClass ]")   
#endDef

###########################################################
# Create DDS JDBC Provider - NEW Implementation Class 1.31
###########################################################

def createDDSJDBCProvider2(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'DDS SQL Driver' -description 'DDS SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")    
#endDef    

#########################
# Create SIB
#########################

def createSIB(sibBusName):
    return AdminTask.createSIBus("[-bus "+sibBusName+" -busSecurity false -scriptCompatibility 6.1 ]")
#endDef


#######################################
# Link SIB to Cluster   
#######################################

def linkSIBtoCluster(sibName,clusterName,datasourceJNDI,schemaName):
    #1. schemaName -- WORKING
    AdminTask.addSIBusMember("[-bus "+sibName+" -cluster "+clusterName+" -enableAssistance true -policyName SCALABILITY -dataStore  -createDefaultDatasource false -datasourceJndiName "+datasourceJNDI+" -createTables false -restrictLongDBLock false -schemaName "+schemaName+" ]")
    print "<< exit Sib Link"    
#endDef


#######################################
# Create SIB Destinations   
#######################################

def createSIBDestination(sibBusName,queueName, clusterName):
    AdminTask.createSIBDestination("[-bus "+sibBusName+" -name "+queueName+" -type Queue -reliability ASSURED_PERSISTENT -description  -cluster "+clusterName+"]")
    print "<< exit sib destination "
#endDef

##############################################################################    1.9 #################################################################################

#######################################
# Create Activation Spec
#######################################

def createActivationSpec(cellName,clusterName,activationSpecName,activationSpecJndi,destinationJndi,sibBusName):
    
    # 1. ActivationSpecName
    # 2. Activation Spec Jndi
    # 3. SIB Bus
    # 4. clusterName
    # 5. Destination JNDI -- WORKING
    AdminTask.createSIBJMSActivationSpec(clusterName+"(cells/"+cellName+"/clusters/"+clusterName+"|cluster.xml)", "[-name "+activationSpecName+" -jndiName "+activationSpecJndi+" -destinationJndiName "+destinationJndi+" -description  -busName "+sibBusName+" -clientId  -durableSubscriptionHome  -destinationType javax.jms.Queue -messageSelector  -acknowledgeMode Auto-acknowledge -subscriptionName  -maxBatchSize 1 -maxConcurrency 10 -subscriptionDurability NonDurable -shareDurableSubscriptions InCluster -authenticationAlias  -readAhead Default -target  -targetType BusMember -targetSignificance Preferred -targetTransportChain  -providerEndPoints  -shareDataSourceWithCMP false -consumerDoesNotModifyPayloadAfterGet false -forwarderDoesNotModifyPayloadAfterSet false -alwaysActivateAllMDBs false -retryInterval 30 -autoStopSequentialMessageFailure 0 -failingMessageDelay 0]")
    print "<< exit activation spec"
#endDef


#########################
# create JMS QCF
#########################
def createJmsQcf(cellName,clusterName,jmsQcfName, jmsQcfJndi, sibName):
    #1. cellName 
    #2. clusterName 
    #3. QCF Name 
    #4. QCF JNDI     
    #5. SIB Name -- WORKING
    AdminTask.createSIBJMSConnectionFactory(clusterName+"(cells/"+cellName+"/clusters/"+clusterName+"|cluster.xml)", "[-type queue -name "+jmsQcfName+" -jndiName "+jmsQcfJndi+" -description  -category  -busName "+sibName+" -nonPersistentMapping ExpressNonPersistent -readAhead Default -tempQueueNamePrefix  -target  -targetType BusMember -targetSignificance Preferred -targetTransportChain  -providerEndPoints  -connectionProximity Bus -authDataAlias  -containerAuthAlias  -mappingAlias  -shareDataSourceWithCMP false -logMissingTransactionContext false -manageCachedHandles false -xaRecoveryAuthAlias  -persistentMapping ReliablePersistent -consumerDoesNotModifyPayloadAfterGet false -producerDoesNotModifyPayloadAfterSet false]")
#endDef

def createJmsQcf61(cellName,clusterName,jmsQcfName, jmsQcfJndi, sibName):
    #1. cellName 
    #2. clusterName 
    #3. QCF Name 
    #4. QCF JNDI     
    #5. SIB Name -- WORKING
    AdminTask.createSIBJMSConnectionFactory(clusterName+"(cells/"+cellName+"/clusters/"+clusterName+"|cluster.xml)", "[-type queue -name "+jmsQcfName+" -jndiName "+jmsQcfJndi+" -description  -category  -busName "+sibName+" -nonPersistentMapping ExpressNonPersistent -readAhead Default -tempQueueNamePrefix  -target  -targetType BusMember -targetSignificance Preferred -targetTransportChain  -providerEndPoints  -connectionProximity Bus -authDataAlias -shareDataSourceWithCMP false -logMissingTransactionContext false -manageCachedHandles false -xaRecoveryAuthAlias  -persistentMapping ReliablePersistent ]")
#endDef

#############################
# create JMS Queue
#############################


def createJmsQueue(cellName,clusterName,queueName,queueJndiName,sibBusName, sibQueue):
    #1. Queue Name
    #2. Queue Jndi Name
    #3. Sib Bus Name
    #4. Add Cell Name
    #5. Add ClusterName 
    #6 Add ClusterName first 
    #7. Added SIB Queue 
    #8. producerPreferLocal -- WORKING
    AdminTask.createSIBJMSQueue(clusterName+"(cells/"+cellName+"/clusters/"+clusterName+"|cluster.xml)", "[-name "+queueName+" -jndiName "+queueJndiName+" -description  -deliveryMode Application -readAhead AsConnection -busName "+sibBusName+" -queueName "+sibQueue+" -scopeToLocalQP false -producerBind false -producerPreferLocal false -gatherMessages false]")
    print "<< exit JMS"
#endDef

def createJmsQueue61(cellName,clusterName,queueName,queueJndiName,sibBusName, sibQueue):
    #1. Queue Name
    #2. Queue Jndi Name
    #3. Sib Bus Name
    #4. Add Cell Name
    #5. Add ClusterName 
    #6 Add ClusterName first 
    #7. Added SIB Queue 
    #8. producerPreferLocal -- WORKING
    AdminTask.createSIBJMSQueue(clusterName+"(cells/"+cellName+"/clusters/"+clusterName+"|cluster.xml)", "[-name "+queueName+" -jndiName "+queueJndiName+" -description  -deliveryMode Application -readAhead AsConnection -busName "+sibBusName+" -queueName "+sibQueue+" ]")
    print "<< exit JMS"


#############################
# create WebSphere Variables
#############################

def createWebSphereVariable(cellName,clusterName,varName1,varValue1):
    #1. cellName 
    #2. clusterName -- WORKING
    variableId = AdminConfig.list('VariableSubstitutionEntry', AdminConfig.getid( "/Cell:"+cellName+"/ServerCluster:"+clusterName+"/"))
    # 3. clusterName
    AdminConfig.create('VariableSubstitutionEntry', "(cells/"+cellName+"/clusters/"+clusterName+"|variables.xml)", '[[symbolicName "MICROSOFT_JDBC_DRIVER_PATH"] [description ""] [value "D:\IBM\WebSphere\AppServer\lib" ]]')
#endDef


#############################
# modifyJDK
#############################


def modifyJDK(nodeName, serverName):
    # nodeName -- WORKING
    # serverName
    AdminTask.setServerSDK("[-nodeName "+nodeName+" -serverName "+serverName+" -sdkName 1.7_64]")
#endDef

##############################################################################    1.14 #################################################################################

############################
# Create STG JDBC Provider
############################
def createSTGJDBCProvider(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'STG SQL Driver' -description 'STG SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef    

############################################################
# Create STG JDBC Provider  - New Implementation Class 1.32
############################################################

def createSTGJDBCProvider2(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'STG SQL Driver' -description 'STG SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef    



#######################################
# Modify DDS Virtual Host
#######################################

def modifySTGVirtualHostPort(cellName,virtualHost,virtualHostPort):
    #return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:" +cellName+"/"), "[[name ," +virtualHost+ "]]")
    #1 cellName 
    #2 virtualHost -- WORKING   
    AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9081"]]')   
    return AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9087"]]')   
#endDef

##########################
# Create BO JDBC Provider 
##########################

def createBOJDBCProvider(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'BO SQL Driver' -description 'BO SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef    


###########################################################
# Create BO JDBC Provider  - New Implementation Class 1.33
###########################################################

def createBOJDBCProvider2(clusterName,jdbcProviderName):    
    #1. Change Cluster
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'BO SQL Driver' -description 'BO SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef  

def modifyBOVirtualHostPort(cellName,virtualHost,virtualHostPort):
    #return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:" +cellName+"/"), "[[name ," +virtualHost+ "]]")
    #1 cellName 
    #2 virtualHost -- WORKING   
    AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9082"]]')    
    return AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9086"]]')    
#endDef

def createTRADEJDBCProvider(clusterName,jdbcProviderName):
    #Nothing
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'TRADE SQL Driver' -description 'TRADE SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef  

##############################################################
# Create TRADE JDBC Provider  - New Implementation Class 1.34
##############################################################

def createTRADEJDBCProvider2(clusterName,jdbcProviderName):
    #Nothing
    return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'TRADE SQL Driver' -description 'TRADE SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef  

def modifyTradeVirtualHostPort(cellName,virtualHost,virtualHostPort):
    #return AdminConfig.create('VirtualHost', AdminConfig.getid("/Cell:" +cellName+"/"), "[[name ," +virtualHost+ "]]")
    #1 cellName 
    #2 virtualHost -- WORKING   
    return AdminConfig.create('HostAlias', AdminConfig.getid("/Cell:"+cellName+"/VirtualHost:"+virtualHost+"/"), '[[hostname "*"] [port "9080"]]')    
#endDef  

def createDEDUPJDBCProvider(clusterName,jdbcProviderName):
    #Nothing    
	return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationType 'Connection pool data source' -name 'DEDUP SQL Driver' -description 'DEDUP SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef    

##############################################################
# Create DEDUP JDBC Provider  - New Implementation Class 1.35
##############################################################

def createDEDUPJDBCProvider2(clusterName,jdbcProviderName):
    #Nothing    
	return AdminTask.createJDBCProvider("[-scope Cluster="+clusterName+" -databaseType 'SQL Server' -providerType 'Microsoft SQL Server JDBC Driver' -implementationClassName 'com.microsoft.sqlserver.jdbc.SQLServerXADataSource' -implementationType 'Connection pool data source' -name 'DEDUP SQL Driver' -description 'DEDUP SQL Server JDBC Driver.' -classpath [${MICROSOFT_JDBC_DRIVER_PATH}/sqljdbc4.jar ]  ]")   
#endDef    

def modifyPrimaryPorts(serverName,nodeName,hostName):
    # nodeName 
    # hostName 
    # serverName -- WORKING
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName BOOTSTRAP_ADDRESS -host "+hostName+" -port 9809 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName CSIV2_SSL_MUTUALAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9402 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9403 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName DCS_UNICAST_ADDRESS -host * -port 9352 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName IPC_CONNECTOR_ADDRESS -host localhost -port 9632 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName ORB_LISTENER_ADDRESS -host "+hostName+" -port 9100 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName OVERLAY_TCP_LISTENER_ADDRESS -host * -port 11006 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName OVERLAY_UDP_LISTENER_ADDRESS -host * -port 11005 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SAS_SSL_SERVERAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9401 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_ENDPOINT_ADDRESS -host * -port 7276 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_ENDPOINT_SECURE_ADDRESS -host * -port 7287 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_MQ_ENDPOINT_ADDRESS -host * -port 5558 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_MQ_ENDPOINT_SECURE_ADDRESS -host * -port 5578 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIP_DEFAULTHOST -host * -port 5060 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIP_DEFAULTHOST_SECURE -host * -port 5061 -modifyShared true ]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SOAP_CONNECTOR_ADDRESS -host "+hostName+" -port 8879 -modifyShared true]")
#endDef


def modifyDS(cellName,clusterName,jdbcProviderName,datasourceName1, database, server, attributeName1, typeObject1, dsvalue1, attributeName2, typeObject2, dsvalue2, attributeName3, typeObject3, dsvalue3, applicationName):
	print " Setting the properties for DataSource :"+ datasourceName1
	print " Setting the properties for JdbcProviderName :"+ jdbcProviderName
	newds1 = AdminConfig.getid('/Cell:'+ cellName +'/ServerCluster:'+ clusterName +'/JDBCProvider:'+ jdbcProviderName +'/DataSource:'+ datasourceName1)
	propSet = AdminConfig.create('J2EEResourcePropertySet' , newds1 , "")
	print " Attribute Name is "+attributeName1

	#Set database
	name1 = ["name" , "databaseName" ]
	type1 = ["type" , "java.lang.String"]
	required1 = ["required" , "false"]
	value1 = ["value" , database]
    
	#Set server
	name2 = ["name" , "serverName" ]
	type2 = ["type" , "java.lang.String"]
	required2 = ["required" , "false"]
	value2 = ["value" , server] 
	# If applicationName = OWB etc set Application name
	if (dsvalue1 == applicationName):
		name3 = ["name" , attributeName1 ]
		type3 = ["type" , typeObject1]
		required3 = ["required" , "false"]
		value3 = ["value" , dsvalue1]
	#endIf	
	if (dsvalue1 == applicationName):
		name4 = ["name" , attributeName2 ]
		type4 = ["type" , typeObject2]
		required4 = ["required" , "false"]
		value4 = ["value" , dsvalue2]
	#endIf
	if (dsvalue1 == applicationName):
		name5 = ["name" , attributeName3 ]
		type5 = ["type" , typeObject3]
		required5 = ["required" , "false"]
		value5 = ["value" , dsvalue3]
	#endIf

	rpAttrs = [name1 , type1 , required1 , value1 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs)
	print " Property 1 Database Set !"
	rpAttrs2 = [name2, type2 , required2, value2 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs2)
	print " Property 2 Server Set !"
	print " Setting attribute Name is "+attributeName1
	if (dsvalue1 == applicationName):
		rpAttrs3 = [name3, type3 , required3, value3 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs3)
		print " Property 3 Application Name Set !"
	#endIf

	if (dsvalue1 == applicationName):
		rpAttrs4 = [name4, type4 , required4, value4 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs4)
		print " Property 4 User Set !"
	#endIf
	if (dsvalue1 == applicationName):
		rpAttrs5 = [name5, type5 , required5, value5 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs5)
		print " Property 5 Set !"
	#endIf
	print " Properties created for DataSource :"+ datasourceName1
#endDefdef modifyDS(cellName,clusterName,jdbcProviderName,datasourceName1, database, server, attributeName1, typeObject1, dsvalue1, attributeName2, typeObject2, dsvalue2, attributeName3, typeObject3, dsvalue3, applicationName):
	print " Setting the properties for DataSource :"+ datasourceName1
	print " Setting the properties for JdbcProviderName :"+ jdbcProviderName
	newds1 = AdminConfig.getid('/Cell:'+ cellName +'/ServerCluster:'+ clusterName +'/JDBCProvider:'+ jdbcProviderName +'/DataSource:'+ datasourceName1)
	propSet = AdminConfig.create('J2EEResourcePropertySet' , newds1 , "")
	print " Attribute Name is "+attributeName1

	#Set database
	name1 = ["name" , "databaseName" ]
	type1 = ["type" , "java.lang.String"]
	required1 = ["required" , "false"]
	value1 = ["value" , database]
    
	#Set server
	name2 = ["name" , "serverName" ]
	type2 = ["type" , "java.lang.String"]
	required2 = ["required" , "false"]
	value2 = ["value" , server] 
	# If applicationName = OWB etc set Application name
	if (dsvalue1 == applicationName):
		name3 = ["name" , attributeName1 ]
		type3 = ["type" , typeObject1]
		required3 = ["required" , "false"]
		value3 = ["value" , dsvalue1]
	#endIf	
	if (dsvalue1 == applicationName):
		name4 = ["name" , attributeName2 ]
		type4 = ["type" , typeObject2]
		required4 = ["required" , "false"]
		value4 = ["value" , dsvalue2]
	#endIf
	if (dsvalue1 == applicationName):
		name5 = ["name" , attributeName3 ]
		type5 = ["type" , typeObject3]
		required5 = ["required" , "false"]
		value5 = ["value" , dsvalue3]
	#endIf

	rpAttrs = [name1 , type1 , required1 , value1 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs)
	print " Property 1 Database Set !"
	rpAttrs2 = [name2, type2 , required2, value2 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs2)
	print " Property 2 Server Set !"
	print " Setting attribute Name is "+attributeName1
	if (dsvalue1 == applicationName):
		rpAttrs3 = [name3, type3 , required3, value3 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs3)
		print " Property 3 Application Name Set !"
	#endIf

	if (dsvalue1 == applicationName):
		rpAttrs4 = [name4, type4 , required4, value4 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs4)
		print " Property 4 User Set !"
	#endIf
	if (dsvalue1 == applicationName):
		rpAttrs5 = [name5, type5 , required5, value5 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs5)
		print " Property 5 Set !"
	#endIf
	print " Properties created for DataSource :"+ datasourceName1
#endDef

############################################################################################################################################################################################
############################################################################################################################################################################################

#######################################
# Modify DS - WebSphere Isolation level
#######################################

def modifyDS2(cellName,clusterName,jdbcProviderName,datasourceName1, database, server, attributeName4, typeObject4, dsvalue4, attributeName5, typeObject5, dsvalue5, attributeName6, typeObject6, dsvalue6, applicationName):
	print " Setting the properties for DataSource :"+ datasourceName1
	print " Setting the properties for JdbcProviderName :"+ jdbcProviderName
	newds1 = AdminConfig.getid('/Cell:'+ cellName +'/ServerCluster:'+ clusterName +'/JDBCProvider:'+ jdbcProviderName +'/DataSource:'+ datasourceName1)
	propSet = AdminConfig.create('J2EEResourcePropertySet' , newds1 , "")
	print " Attribute Name is "+attributeName4

	#Set database for DS
	name1 = ["name" , "databaseName" ]
	type1 = ["type" , "java.lang.String"]
	required1 = ["required" , "false"]
	value1 = ["value" , database]
    
	#Set server for DS
	name2 = ["name" , "serverName" ]
	type2 = ["type" , "java.lang.String"]
	required2 = ["required" , "false"]
	value2 = ["value" , server] 
	
	name3 = ["name" , "webSphereDefaultIsolationLevel" ]
	type3 = ["type" , "java.lang.Integer"]
	required3 = ["required" , "false"]
	value3 = ["value" , 2] 
	
	
	# If applicationName = OWB, DDS, SIB_DDS etc set Application name
	if (dsvalue4 == applicationName):
		name4 = ["name" , attributeName4 ]
		type4 = ["type" , typeObject4]
		required4 = ["required" , "false"]
		value4 = ["value" , dsvalue4]
	#endIf	
	
	# If the dsValue (first) does not equal the Application Name, set user and password.
	if (dsvalue4 != applicationName):
		# Setting user for DS
		name5 = ["name" , attributeName5 ]
		type5 = ["type" , typeObject5]
		required5 = ["required" , "false"]
		value5 = ["value" , dsvalue5]
		# Setting password for DS
		name6 = ["name" , attributeName6 ]
		type6 = ["type" , typeObject6]
		required6 = ["required" , "false"]
		value6 = ["value" , dsvalue6]
	#endIf

	# Set database
	rpAttrs = [name1 , type1 , required1 , value1 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs)
	# Set server
	print " Property 1 Database Set !"
	rpAttrs2 = [name2, type2 , required2, value2 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs2)
	# set Isolation level
	rpAttrs3 = [name3, type3 , required3, value3 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs3)
	# Set Application name
	rpAttrs4 = [name4, type4 , required4, value4 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs4)
	#endIf

	if (dsvalue4 != applicationName):
		rpAttrs5 = [name5, type5 , required5, value5 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs5)
		print " User for DS set !"
		rpAttrs6 = [name6, type6 , required6, value6 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs6)
		print " Password for DS set !"
	#endIf
	
	print " Properties created for DataSource :"+ datasourceName1
#endDef

#######################################
# Modify DS Integrated Security
#######################################

def modifyDS3(cellName,clusterName,jdbcProviderName,datasourceName1, database, server, attributeName4, typeObject4, dsvalue4, attributeName5, typeObject5, dsvalue5, attributeName6, typeObject6, dsvalue6, applicationName, integratedSecurity):
	print " Setting the properties for DataSource :"+ datasourceName1
	print " Setting the properties for JdbcProviderName :"+ jdbcProviderName
	newds1 = AdminConfig.getid('/Cell:'+ cellName +'/ServerCluster:'+ clusterName +'/JDBCProvider:'+ jdbcProviderName +'/DataSource:'+ datasourceName1)
	propSet = AdminConfig.create('J2EEResourcePropertySet' , newds1 , "")


	#Set database for DS
	name1 = ["name" , "databaseName" ]
	type1 = ["type" , "java.lang.String"]
	required1 = ["required" , "false"]
	value1 = ["value" , database]
    
	#Set server for DS
	name2 = ["name" , "serverName" ]
	type2 = ["type" , "java.lang.String"]
	required2 = ["required" , "false"]
	value2 = ["value" , server] 
	
	#Set server for Isolation Levels
	name3 = ["name" , "webSphereDefaultIsolationLevel" ]
	type3 = ["type" , "java.lang.Integer"]
	required3 = ["required" , "false"]
	value3 = ["value" , 2] 
	
	name4 = ["name" , attributeName4 ]
	type4 = ["type" , typeObject4]
	required4 = ["required" , "false"]
	
	name7 = ["name" , "integratedSecurity" ]
	type7 = ["type" , "java.lang.Boolean"]
	required7 = ["required" , "false"]
	
	# If applicationName = OWB, DDS, SIB_DDS etc set Application name
	if (dsvalue4 == applicationName):
		value4 = ["value" , dsvalue4]
		# Setting for Integrated Security
		value7 = ["value" , integratedSecurity]
	#endIf	
	else:
		value4 = ["value" , dsvalue4]
		value7 = ["value" , "false"]
	#endElse
			
	
	# If the dsValue (first) does not equal the Application Name, set user and password.
	if (dsvalue4 != applicationName):
		# Setting user for DS
		name5 = ["name" , attributeName5 ]
		type5 = ["type" , typeObject5]
		required5 = ["required" , "false"]
		value5 = ["value" , dsvalue5]
		# Setting password for DS
		name6 = ["name" , attributeName6 ]
		type6 = ["type" , typeObject6]
		required6 = ["required" , "false"]
		value6 = ["value" , dsvalue6]
	#endIf

	# Set database
	rpAttrs = [name1 , type1 , required1 , value1 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs)
	# Set server
	print " Property 1 Database Set !"
	rpAttrs2 = [name2, type2 , required2, value2 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs2)
	# set Isolation level
	rpAttrs3 = [name3, type3 , required3, value3 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs3)
	# Set Application name
	rpAttrs4 = [name4, type4 , required4, value4 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs4)
	
	# Set Application name
	rpAttrs7 = [name7, type7 , required7, value7 ]
	jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs7)


	if (dsvalue4 != applicationName):
		rpAttrs5 = [name5, type5 , required5, value5 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs5)
		print " User for DS set !"
		rpAttrs6 = [name6, type6 , required6, value6 ]
		jrp = AdminConfig.create('J2EEResourceProperty' , propSet , rpAttrs6)
		print " Password for DS set !"
	#endIf
	
	print " Properties created for DataSource :"+ datasourceName1
#endDef

########### 1.24

def createWebServer(webserver):
    # AdminTask.createWebServer('webserver1', '[-name webserver1 -templateName IIS -serverConfig [-webPort 80 -serviceName  -webInstallRoot  -webProtocol HTTP -configurationFile  -errorLogfile  -accessLogfile  -pluginInstallRoot D:\IBM\WebSphere\Plugins -webAppMapping ALL] -remoteServerConfig [-adminPort 8008 -adminUserID  -adminPasswd  ******** HTTP]]')
    #1. webserver
    AdminTask.createWebServer("webserver", '[-name webserver1 -templateName IIS -serverConfig [-webPort 80 -serviceName  -webInstallRoot  -webProtocol HTTP -configurationFile  -errorLogfile  -accessLogfile  -pluginInstallRoot D:\IBM\WebSphere\Plugins -webAppMapping ALL] -remoteServerConfig [-adminPort 8008 -adminUserID  -adminPasswd  ******** HTTP]]')
#endDef

########### 1.25

def setObjectProperty (objectName, propertyName, propertyValue):
    AdminConfig.modify(objectName, [[propertyName, propertyValue]])
#endDef

def updateWebContainerVirtualHost (server, virtualHostName):
    for wc in toList(AdminConfig.list("WebContainer", server)):
        setObjectProperty(wc, "defaultVirtualHostName", virtualHostName)
    #endFor
#endDef

def configureVirtualHost (virtualHostName, aliases, portNumbers):
    virtualHost = AdminConfig.create("VirtualHost", AdminConfig.list("Cell"), [["name", virtualHostName]])
    for alias in aliases:
        print ' HostAlias : %s , Port: %s ' % (alias, portNumbers['WC_defaulthost'])
        AdminConfig.create("HostAlias", virtualHost, [["hostname", alias], ["port", portNumbers['WC_defaulthost']]])
        print ' HostAlias : %s , Port: %s ' % (alias, portNumbers['WC_defaulthost_secure'])
        AdminConfig.create("HostAlias", virtualHost, [["hostname", alias], ["port", portNumbers['WC_defaulthost_secure']]])
    #endFor
#endDef

#######################################
# Splits list into string
#######################################

def _splitlist(s):
    """Given a string of the form [item item item], return a list of strings, one per item.
    WARNING: does not yet work right when an item has spaces.  I believe in that case we'll be
    given a string like '[item1 "item2 with spaces" item3]'.
    """
    if s[0] != '[' or s[-1] != ']':
        raise "Invalid string: %s" % s
    return s[1:-1].split(' ')
#endDef

###############  1.27

def modifySecondaryPorts(serverName,nodeName,hostName):
    # nodeName 
    # hostName 
    # serverName -- WORKING
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName BOOTSTRAP_ADDRESS -host "+hostName+" -port 9810 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName CSIV2_SSL_MUTUALAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9406 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName CSIV2_SSL_SERVERAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9405 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName DCS_UNICAST_ADDRESS -host * -port 9354 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName IPC_CONNECTOR_ADDRESS -host localhost -port 9632 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName ORB_LISTENER_ADDRESS -host "+hostName+" -port 9101 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName OVERLAY_TCP_LISTENER_ADDRESS -host * -port 11007 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName OVERLAY_UDP_LISTENER_ADDRESS -host * -port 11008 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SAS_SSL_SERVERAUTH_LISTENER_ADDRESS -host "+hostName+" -port 9404 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_ENDPOINT_ADDRESS -host * -port 7277 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_ENDPOINT_SECURE_ADDRESS -host * -port 7287 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_MQ_ENDPOINT_ADDRESS -host * -port 5559 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIB_MQ_ENDPOINT_SECURE_ADDRESS -host * -port 5579 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIP_DEFAULTHOST -host * -port 5062 -modifyShared true]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SIP_DEFAULTHOST_SECURE -host * -port 5063 -modifyShared true ]")
    AdminTask.modifyServerPort(serverName, "[-nodeName "+nodeName+" -endPointName SOAP_CONNECTOR_ADDRESS -host "+hostName+" -port 8880 -modifyShared true]")
#endDef

##############  1.28

def modifyLogging(cellName,nodeName,serverName):
    if (trace == "ON"):
        print "Get variable 1"
    #endIf
    var1 = AdminConfig.getid("/Cell:"+cellName+"/Node:"+nodeName+"/Server:"+serverName+"/")
    # get the Object id
    print "Get standard out"
    stdoutlog = AdminConfig.showAttribute(var1, "outputStreamRedirect" )
    stderrlog = AdminConfig.showAttribute(var1, "errorStreamRedirect" )
    # Set Attrs
    
    AdminConfig.modify(stdoutlog, [["rolloverType", "TIME"], ["baseHour", 1], ["rolloverPeriod", 24],["maxNumberOfBackupFiles", 30],["rolloverSize", 50]] )
    AdminConfig.modify(stderrlog, [["rolloverType", "TIME"], ["baseHour", 1], ["rolloverPeriod", 24],["maxNumberOfBackupFiles", 30],["rolloverSize", 50]] )
#endDef

############# 1.29
def createSecondaryMember(clusterName,node2Name,serverName):
    #AdminTask.createClusterMember('[-clusterName POS_OWB_CLUSTER_DEV1 -memberConfig [-memberNode POS_DDS_NODE_1_DEV1 -memberName POS_OWB_SRV_2_DEV1 -memberWeight 2 -genUniquePorts false -replicatorEntry false]]')
    AdminTask.createClusterMember("[-clusterName "+clusterName+" -memberConfig [-memberNode " +node2Name+" -memberName "+serverName+" -memberWeight 2 -genUniquePorts false -replicatorEntry false]]")
#endDef

def createWMQ(nodeName,cellName,queueName,jmsWMQName,mqName):
		#AdminTask.createWMQQueue('POS_DDS_NODE_1_DEV1(cells/POS_DEV1/nodes/POS_DDS_NODE_1_DEV1|node.xml)', '[-name POSLOG -jndiName jms/POSLOG -queueName TEST.QUEUE1 -qmgr  -description  ]')
		# nodeName
		# cellName
		# queueName --> WORKING
		# jmsWMQName
		AdminTask.createWMQQueue(nodeName+"(cells/"+cellName+"/nodes/"+nodeName+"|node.xml)", "[-name "+queueName+" -jndiName "+jmsWMQName+" -queueName "+mqName+" -qmgr  -description  ]")
#endDef

#######################################################################################################################


def createVirtualHostNew():
	AdminConfig.create('VirtualHost', AdminConfig.getid('/Cell:AdminControl.getCell()/'), '[[name, "+new_host+"]]')
	AdminConfig.create('HostAlias', AdminConfig.getid('/Cell:AdminControl.getCell()/VirtualHost:"+new_host+"/'), '[[port ,"+port+"] [hostname ,"+host_name+"]]')
#endDef

def modifyJDBCClass(cellName,clusterName):
	# cellName
	# clusterName
	items = AdminConfig.list('JDBCProvider',AdminConfig.getid("/Cell:"+cellName+"/ServerCluster:"+clusterName))    
	lines = wsadminToList(items)
	print "Line 1 " +lines[0]
	print "Line 2 " +lines[1]
	print "Line 3 " +lines[2]
	
	#AdminConfig.modify("(cells/"+cellName+"/clusters/"+clusterName+"|resources.xml#JDBCProvider_1408959860094)", '[[name "DDS SQL Driver"] [implementationClassName "com.microsoft.sqlserver.jdbc.SQLServerXADataSource"] [isolatedClassLoader "false"] [description "DDS SQL Server JDBC Driver."]]')
#endDef
